//
//  MainTabBarController.m
//  07--第二题
//
//  Created by 冀永金 on 16/7/23.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "MainTabBarController.h"
#import "JYNavigationController.h"
#import "YJTabBar.h"
#import "HomwViewController.h"
#import "DiscoverViewController.h"
#import "WriteViewController.h"
#import "MessageViewController.h"
#import "MineViewController.h"
@interface MainTabBarController ()

@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildVc:[[HomwViewController alloc]init] image:@"shouye1" selectedImage:@"shouye2"];
    [self addChildVc:[[DiscoverViewController alloc]init] image:@"faxian1" selectedImage:@"faxian2"];
    [self addChildVc:[[WriteViewController alloc]init] image:@"xiezuo" selectedImage:@"xiezuo"];
    [self addChildVc:[[MessageViewController alloc]init] image:@"xiaoxi" selectedImage:@"xiaoxi"];
    [self addChildVc:[[MineViewController alloc]init] image:@"wo" selectedImage:@"wo"];
//    YJTabBar *tabbar = [[YJTabBar alloc]init];
//    [self setValue:tabbar forKey:@"tabbar"];
    // Do any additional setup after loading the view.
}
- (void)addChildVc:(UIViewController *)childVc image:(NSString *)image selectedImage:(NSString *)selectedImage
{
    
    
    // 设置子控制器的tabBarItem图片
    childVc.tabBarItem.image = [UIImage imageNamed:image];
    // 禁用图片渲染
    childVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    JYNavigationController *navi = [[JYNavigationController alloc]initWithRootViewController:childVc];
    [self addChildViewController:navi];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
